--Ejercicio 1
max2(x,y) 	|x>=y =x
			|otherwise = y
-- :t max2
--max2 :: Ord a => (a,a) -> a
			
normaVectorial(x,y) =sqrt(x^2 + y^2)			
-- :t normaVectorial
--normaVectorial :: Floating a => (a,a) -> a

substract = flip (-)
-- :t substract
--substract :: Integer -> Integer -> Integer

restarUno = substract 1
-- :t restarUno
--restarUno :: Integer -> Integer

evaluarEnCero = \f-> f 0
-- :t evaluarEnCero
--evaluarEnCero :: (Integer -> a) -> a

dosVeces = \f -> f.f
-- :t dosVeces
--dosVeces :: (a -> a) -> a -> a

flipAll = map flip
-- :t flipAll
--flipAll :: [a -> b -> c] -> [b -> a -> c]


--Ejercicio 2
curry f = \x -> \y -> f (x,y)
uncurry f = \(x,y) -> f x y

--Ejercicio 5
primos :: [Int]
primos = [x|x<-[2..1000], length(divisores x) == 2]

divisores:: Int->[Int]
divisores n= [x|x<-[1..n], n `mod` x == 0]

--Ejercicio 9
suma:: [Int]->Int
suma xs = foldr (+) 0 xs

elemento::Eq a => a->[a]->Bool
elemento y xs= foldr ((||).(==y)) False xs

concatenar:: [a]->[a]->[a]
concatenar xs ys = foldr (:) ys xs

filtrar :: (a->Bool)->[a]->[a]
filtrar f (x:xs) = (x:xs)

mapear:: (a->b)->[a]->[b]
mapear f xs = foldr ((:).f) [] xs
